package com.paas.form.controller;


import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bpm.feign.model.ProcessCmd;
import com.bpm.feign.service.IBpmProcessInstanceService;
import com.paas.common.model.BaseUserInfo;
import com.paas.common.model.RestResponse;
import com.paas.common.page.PageBean;
import com.paas.common.util.StringUtil;
import com.paas.common.web.SystemConst;
import com.paas.form.constant.FormConstant;
import com.paas.form.dto.FormViewSearchDetailDto;
import com.paas.form.entity.*;
import com.paas.form.service.*;
import com.paas.form.vo.FormPageVo;
import com.paas.form.vo.FormViewCmdVo;
import com.paas.form.vo.InitMasterDataVo;
import com.paas.form.vo.QueryByViewIdVo;
import com.paas.plus.tool.form.model.*;
import com.paas.plus.tool.form.server.FormServer;
import com.publics.entity.UcUserEntity;
import com.publics.feign.service.IUcUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.paas.common.util.BeanUtil;
import com.paas.common.web.annotion.OperLog;
import com.paas.common.web.controller.BaseController;
import com.paas.common.web.oper.OprLogConstant;

@RestController
@RequestMapping(value = "/form/formView")
@Api(description = "视图模块", tags = "")
public class FormViewController extends BaseController {

    @Autowired
    public IFormViewService formViewService;


    //定版视图
    @Autowired
    public IFormViewPubService formViewPubService;

    @Autowired
    public IFormAttributeService formAttributeService;

    @Autowired
    public IUcUserService ucUserService;


    //定版属性
    @Autowired
    public IFormAttributePubService formAttributePubService;

    @Autowired
    public FormServer formServer;

    @Autowired
    public IBpmProcessInstanceService bpmProcessInstanceService;

    @Autowired
    public IFormDefinitionService formViewPublishService;


    @Autowired
    public IFormViewFinalVersionService formViewFinalVersionService;


    @RequestMapping(value = "/checkSave", method = RequestMethod.POST)
    @ApiOperation(value = "保存信息", notes = "保存信息")
    @OperLog(operType = OprLogConstant.ADD, operModul = "", operDescribe = "-保存")
    public RestResponse checkSave(@RequestBody FormViewEntity formViewEntity) throws ParseException {
        if (BeanUtil.isNotEmpty(formViewEntity)) {
            if(StringUtil.isNotEmpty(formViewEntity.getName())){
                try{
                    QueryWrapper<FormViewEntity> queryWrapper = new QueryWrapper<>();
                    queryWrapper.eq("name",formViewEntity.getName());
                    FormViewEntity bean = formViewService.getOne(queryWrapper);
                    if(BeanUtil.isNotEmpty(bean)){
                        if(StringUtil.isNotEmpty(formViewEntity.getId())&&formViewEntity.getId().equals(bean.getId())){
                            String sucMsg="保存";
                        }else {
                            return RestResponse.error("该视图标题名称已存在");
                        }
                    }
                }catch (Exception e){
                    e.printStackTrace();
                    return RestResponse.error("该视图标题名称已存在");
                }


            }
            injectUpdateDataAuth(formViewEntity);
            formViewEntity.setStatus(SystemConst.NORMAL_STATUS);
        }
        formViewService.save(formViewEntity);
        return RestResponse.success();
    }

    @RequestMapping(value = "/save", method = RequestMethod.POST)
    @ApiOperation(value = "保存信息", notes = "保存信息")
    @OperLog(operType = OprLogConstant.ADD, operModul = "", operDescribe = "-保存")
    public void save(@RequestBody FormViewEntity formViewEntity) throws ParseException {
        if (BeanUtil.isNotEmpty(formViewEntity)) {
            injectUpdateDataAuth(formViewEntity);
            formViewEntity.setStatus(SystemConst.NORMAL_STATUS);
        }
        formViewService.save(formViewEntity);
    }

    @RequestMapping(value = "/saveBatch", method = RequestMethod.POST)
    @ApiOperation(value = "批量保存信息", notes = "批量保存信息")
    @OperLog(operType = OprLogConstant.UPDATE, operModul = "", operDescribe = "-批量保存修改")
    public void saveBatch(@RequestBody List<FormViewEntity> list) throws ParseException {
        if (list != null && list.size() > 0) {
            injectUpdateDataAuth(list);
        }
        formViewService.saveBatch(list);
    }

    @RequestMapping(value = "/delectById", method = RequestMethod.GET)
    @ApiOperation(value = "根据Id删除数据", notes = "根据Id删除数据")
    @OperLog(operType = OprLogConstant.DELETE, operModul = "", operDescribe = "-删除")
    public void delectById(String id) {
        if (null != id && !"".equals(id)) {
            FormViewEntity formViewEntity = new FormViewEntity();
            injectUpdateDataAuth(formViewEntity);
            formViewEntity.setId(id);
            formViewService.deleteByEntity(formViewEntity);
        }
    }

    @RequestMapping(value = "/deleteBatchByIds", method = RequestMethod.POST)
    @ApiOperation(value = "根据Id批量删除数据", notes = "根据Id批量删除数据")
    @OperLog(operType = OprLogConstant.DELETE, operModul = "", operDescribe = "-批量删除")
    public void deleteBatchByIds(@RequestBody List<String> ids) {
        if (null != ids && ids.size() > 0) {
            FormViewEntity formViewEntity = new FormViewEntity();
            injectUpdateDataAuth(formViewEntity);
            //formViewService.deleteBatchIds(ids);
            formViewService.deleteBatchIdsWithPermission(ids, formViewEntity);
        }
    }

    @RequestMapping(value = "/queryById", method = RequestMethod.GET)
    @ApiOperation(value = "根据Id查询对象", notes = "根据Id查询对象")
    public FormViewEntity queryById(String id) {
        FormViewEntity bean = formViewService.getById(id);
        return bean;
    }

    @RequestMapping(value = "/queryformViewPubById", method = RequestMethod.GET)
    @ApiOperation(value = "根据Id查询对象", notes = "根据Id查询对象")
    public FormViewPubEntity queryformViewPubById(String id) {
        FormViewPubEntity bean = formViewPubService.getById(id);
        return bean;
    }

    @RequestMapping(value = "/queryBatchByIds", method = RequestMethod.POST)
    @ApiOperation(value = "根据Id查询对象列表", notes = "根据Id查询对象列表")
    public List<FormViewEntity> queryBatchByIds(@RequestBody List<String> ids) {
        List<FormViewEntity> list = formViewService.getBatchByIds(ids);
        return list;
    }

    @RequestMapping(value = "/queryPage", method = RequestMethod.GET)
    @ApiOperation(value = "模板分页查询", notes = "模板分页查询")
    public IPage<FormViewEntity> queryPage(FormViewEntity formViewEntity, Integer currentPage, Integer pageSize) {
        if (currentPage == null) {
            currentPage = 1;
        }
        if (pageSize == null) {
            pageSize = 10;
        }
        injectCheckDataAuth(formViewEntity);
        IPage<FormViewEntity> pageBean = formViewService.getPage(formViewEntity, currentPage, pageSize);
        return pageBean;
    }

    @RequestMapping(value = "/queryPubPage", method = RequestMethod.GET)
    @ApiOperation(value = "模板分页查询", notes = "模板分页查询")
    public IPage<FormViewPubEntity> queryPubPage(FormViewPubEntity formViewPubEntity, Integer currentPage, Integer pageSize) {
        if (currentPage == null) {
            currentPage = 1;
        }
        if (pageSize == null) {
            pageSize = 10;
        }
        injectCheckDataAuth(formViewPubEntity);
        IPage<FormViewPubEntity> pageBean = formViewPubService.getPage(formViewPubEntity, currentPage, pageSize);
        return pageBean;
    }

    @RequestMapping(value = "/queryList", method = RequestMethod.GET)
    @ApiOperation(value = "模板查询", notes = "模板查询")
    public List<FormViewEntity> queryList(FormViewEntity formViewEntity) {
        injectCheckDataAuth(formViewEntity);
        List<FormViewEntity> list = formViewService.getList(formViewEntity);
        return list;
    }

    @RequestMapping(value = "/queryByPublishId", method = RequestMethod.GET)
    @ApiOperation(value = "根据formPublishId查询对象", notes = "根据Id查询对象")
    public FormPageVo queryByPublishId(String id) {
        FormPageVo formViewVo = new FormPageVo();
        FormDefinitionEntity bean = formViewPublishService.getById(id);
        FormViewPubEntity formViewEntity = formViewPubService.getById(bean.getViewId());
        if (BeanUtil.isNotEmpty(formViewEntity)) {
            formViewVo.setFormViewEntity(formViewEntity);
        }
        if (BeanUtil.isNotEmpty(bean)) {
            formViewVo.setFormViewPublishEntity(bean);
        }

        return formViewVo;
    }


    @RequestMapping(value = "/getInitMasterData", method = RequestMethod.GET)
    @ApiOperation(value = "模板查询", notes = "模板查询")
    public InitMasterDataVo getInitMasterData(FormAttributePubEntity formAttributePubEntity) {
        InitMasterDataVo initMasterDataVo = new InitMasterDataVo();
        if (StringUtil.isNotEmpty(formAttributePubEntity.getViewId())) {
            injectCheckDataAuth(formAttributePubEntity);
            List<FormAttributePubEntity> attributes = formAttributePubService.getList(formAttributePubEntity);
            initMasterDataVo.setAttributes(attributes);

            //查询子视图
            FormViewPubEntity formViewPubEntity = new FormViewPubEntity();
            formViewPubEntity.setStatus(SystemConst.NORMAL_STATUS);
            formViewPubEntity.setViewId(formAttributePubEntity.getViewId());
            List<FormViewPubEntity> childViewlist = formViewPubService.getList(formViewPubEntity);
            if (childViewlist.size() > 0) {
                initMasterDataVo.setChildViewEntityList(childViewlist);

                for (int i = 0; i < childViewlist.size(); i++) {
                    FormAttributePubEntity childAttribute = new FormAttributePubEntity();
                    childAttribute.setStatus(SystemConst.NORMAL_STATUS);
                    childAttribute.setViewId(childViewlist.get(i).getId());
                    List<FormAttributePubEntity> childAttributes = formAttributePubService.getList(childAttribute);
                    if (childAttributes.size() > 0) {
                        initMasterDataVo.getChildAttributeMap().put(childViewlist.get(i).getId(), childAttributes);
                    }

                }
            }


        }

        return initMasterDataVo;
    }


    @RequestMapping(value = "/queryTreeDataByViewId", method = RequestMethod.POST)
    @ApiOperation(value = "根据视图id查询数据", notes = "根据视图id查询数据")
    public List<TreeModel> queryTreeDataByViewId(@RequestBody QueryTreeVo queryTreeVo) throws Exception {

//        QueryTreeVo queryTreeVo=new QueryTreeVo();
//        queryTreeVo.setViewId(viewId);
//        queryTreeVo.setIsLazy(false);
//        queryTreeVo.setParentId();
        List<TreeModel> treeModels = formServer.getTreeNodeData(queryTreeVo);

        return treeModels;
    }

    @RequestMapping(value = "/queryPageDataByViewId", method = RequestMethod.POST)
    @ApiOperation(value = "根据视图id查询数据", notes = "根据视图id查询数据")
    public PageBean<Map<String, Object>> queryDataByViewId(@RequestBody QueryListVo queryListVo) throws Exception {
        //处理字段名称显示
        queryListVo.setShowNameFlag(true);
        PageBean<Map<String, Object>> pageList = formServer.getPageList(queryListVo);
        return pageList;
    }

    @RequestMapping(value = "/queryOneDataByViewId", method = RequestMethod.GET)
    @ApiOperation(value = "根据视图id查询一条数据", notes = "根据视图id查询一条数据")
    public Map queryOneDataByViewId(String dataId, String viewId) throws Exception {

        ShowViewItem showViewItem = formServer.getShowViewItem(viewId,dataId,"2");
        if(BeanUtil.isNotEmpty(showViewItem)){
            return showViewItem.getDataMap();
        }else{
            return  null;
        }

    }



    @RequestMapping(value = "/queryDataShowNameByViewId", method = RequestMethod.GET)
    @ApiOperation(value = "根据视图id查询一条数据", notes = "根据视图id查询一条数据")
    public String queryDataShowNameByViewId(String dataId, String viewId) throws Exception {

        ShowViewItem showViewItem = formServer.getShowViewItem(viewId,dataId,"2");
        if(BeanUtil.isNotEmpty(showViewItem)){
            return showViewItem.getViewFieldValue();
        }else{
            return  null;
        }

    }


    @RequestMapping(value = "/queryByViewId", method = RequestMethod.POST)
    @ApiOperation(value = "根据视图id查询数据", notes = "根据视图id查询数据")
    public PageBean<Map<String, Object>> queryByViewId(@RequestBody QueryByViewIdVo queryByViewIdVo) throws Exception {
        PageBean<Map<String, Object>> pageBean = new PageBean<Map<String, Object>>();
        if (StringUtil.isNotEmpty(queryByViewIdVo.getViewId())) {
            if (queryByViewIdVo.getCurrentPage() == null) {
                queryByViewIdVo.setCurrentPage(1);
            }
            if (queryByViewIdVo.getPageSize() == null) {
                queryByViewIdVo.setPageSize(10);
            }
            pageBean.setCurrentPage(queryByViewIdVo.getCurrentPage());
            pageBean.setPagesize(queryByViewIdVo.getPageSize());
            //先根据ViewId查视图对象
            FormViewPubEntity formViewEntity = formViewPubService.getById(queryByViewIdVo.getViewId());
            if (BeanUtil.isNotEmpty(formViewEntity)) {
                //查询视图的属性
                FormAttributePubEntity childAttribute = new FormAttributePubEntity();
                childAttribute.setStatus(SystemConst.NORMAL_STATUS);
                childAttribute.setViewId(queryByViewIdVo.getViewId());
                List<FormAttributePubEntity> attributeList = formAttributePubService.getList(childAttribute);
                //创建分页查询方法的参数对象
                QueryListVo queryListVo = new QueryListVo();
                queryListVo.setViewId(queryByViewIdVo.getViewId());
                queryListVo.setCurrentPage(queryByViewIdVo.getCurrentPage());
                queryListVo.setPageSize(queryByViewIdVo.getPageSize());

                if (attributeList.size() > 0) {
                    List<Column> columns = new ArrayList<>();
                    for (FormAttributePubEntity attribute : attributeList) {
                        Column column = new Column();
                        column.setCode(attribute.getCode());
                        column.setName(attribute.getName());
                        column.setDataType("input");
                        columns.add(column);

                    }
                    queryListVo.setColumn(columns);
                    if(queryByViewIdVo.getCriteria()!=null&&queryByViewIdVo.getCriteria().size()>0){
                        List<Criteria> criterias=new ArrayList<>();
                        for (com.paas.form.vo.Criteria cre: queryByViewIdVo.getCriteria()) {
                            Criteria criteria =new Criteria();
                            criteria.setValue(cre.getValue());
                            criteria.setDataType(cre.getDataType());
                            criteria.setName(cre.getName());
                            criteria.setCode(cre.getCode());
                            criterias.add(criteria);
                        }
                        queryListVo.setCriteria(criterias);
                    }

                }
//                //如果视图是树形，加一个parentId为空的查询条件
//                if("tree".equals(formViewEntity.getType())){
//                    Criteria criteria=new Criteria();
//                    criteria.setCode(formViewEntity.getParentField());
//                    criteria.setName(formViewEntity.getParentField());
//                    criteria.setDataType("input");
//                    List<Criteria> criterias=new ArrayList<>();
//
//                    criterias.add(criteria);
//                    queryListVo.setCriteria(criterias);
//
//                }
                pageBean = formServer.getPageList(queryListVo);
            }


        }

        return pageBean;
    }

    @RequestMapping(value = "/querySearchDetail", method = RequestMethod.GET)
    @ApiOperation(value = "视图查询", notes = "视图查询")
    public FormViewSearchDetailDto querySearchDetail(String id) {
        FormViewSearchDetailDto formViewSearchDetailDto = new FormViewSearchDetailDto();
        QueryWrapper<FormViewEntity> formViewEntityQueryWrapper = new QueryWrapper<>();
        formViewEntityQueryWrapper.eq("id", id);
        FormViewEntity formViewEntity = formViewService.getBaseMapper().selectOne(formViewEntityQueryWrapper);
        QueryWrapper<FormAttributeEntity> attributeEntityQueryWrapper = new QueryWrapper<>();
        attributeEntityQueryWrapper.eq("view_id", id);
        attributeEntityQueryWrapper.eq("status", SystemConst.NORMAL_STATUS);
        List<FormAttributeEntity> formAttributeEntities = formAttributeService.getBaseMapper().selectList(attributeEntityQueryWrapper);
        formViewSearchDetailDto.setFormViewEntity(formViewEntity);
        formViewSearchDetailDto.setViewAttribute(formAttributeEntities);

        formViewEntityQueryWrapper.clear();
        //第一层子级
        formViewEntityQueryWrapper.eq("view_id", id);
        List<FormViewEntity> childFormViewList = formViewService.getBaseMapper().selectList(formViewEntityQueryWrapper);
        setFormViewSearchDetailData(formViewSearchDetailDto, childFormViewList);
        return formViewSearchDetailDto;
    }


    private void setFormViewSearchDetailData(FormViewSearchDetailDto formViewSearchDetailDto, List<FormViewEntity> childFormViewList) {
        if (childFormViewList.size() > 0) {
            ArrayList<FormViewSearchDetailDto> formViewSearchDetailDtos = new ArrayList<>();
            for (int i = 0; i < childFormViewList.size(); i++) {
                FormViewSearchDetailDto childFormViewSearchDetailDto = new FormViewSearchDetailDto();
                FormViewEntity formViewEntity = childFormViewList.get(i);
                childFormViewSearchDetailDto.setFormViewEntity(formViewEntity);
                QueryWrapper<FormAttributeEntity> attributeEntityQueryWrapper = new QueryWrapper<>();
                attributeEntityQueryWrapper.eq("view_id", formViewEntity.getViewId());
                attributeEntityQueryWrapper.eq("status", SystemConst.NORMAL_STATUS);
                List<FormAttributeEntity> formAttributeEntities = formAttributeService.getBaseMapper().selectList(attributeEntityQueryWrapper);
                childFormViewSearchDetailDto.setViewAttribute(formAttributeEntities);
                QueryWrapper<FormViewEntity> formViewEntityQueryWrapper = new QueryWrapper<>();
                formViewEntityQueryWrapper.eq("view_id", formViewEntity.getId());
                List<FormViewEntity> formViewEntityList = formViewService.getBaseMapper().selectList(formViewEntityQueryWrapper);
                setFormViewSearchDetailData(childFormViewSearchDetailDto, formViewEntityList);
                formViewSearchDetailDtos.add(childFormViewSearchDetailDto);
            }
            formViewSearchDetailDto.setViewSearchDetailDtos(formViewSearchDetailDtos);
        }
    }


    @RequestMapping(value = "/finalAutogeneral", method = RequestMethod.POST)
    @ApiOperation(value = "生成定版", notes = "生成定版")
    @OperLog(operType = OprLogConstant.ADD, operModul = "", operDescribe = "-生成定版")
    public RestResponse finalAutogeneral(@RequestBody FormViewCmdVo<ProcessCmd> formViewCmdVo) {
        BaseUserInfo baseUserInfo = getUserInfo();
        if (StringUtil.isNotEmpty(formViewCmdVo.getViewId())) {
            FormViewEntity formViewEntity = formViewService.getById(formViewCmdVo.getViewId());
            if (BeanUtil.isNotEmpty(formViewEntity)) {
                formViewEntity.setBizStatus(FormConstant.CHANGE_OPERATION_APPROVAL);
                formViewService.updateById(formViewEntity);
            }else {
                return RestResponse.error("找不到对应开发视图");
            }
            if (BeanUtil.isNotEmpty(formViewCmdVo.getProcessCmd())) {
                //生成定版中间表
                FormViewFinalVersionEntity viewFinalVersion = new FormViewFinalVersionEntity();
                viewFinalVersion.setViewId(formViewCmdVo.getViewId());
                if(StringUtil.isNotEmpty(formViewCmdVo.getNewViewName())){
                    viewFinalVersion.setNewViewName(formViewCmdVo.getNewViewName());
                }else {
                    viewFinalVersion.setNewViewName(formViewEntity.getName());
                }
                injectUpdateDataAuth(viewFinalVersion);
                viewFinalVersion.setStatus(SystemConst.NORMAL_STATUS);
                formViewFinalVersionService.save(viewFinalVersion);

                ProcessCmd processCmd = formViewCmdVo.getProcessCmd();
                processCmd.setBusinessKey(viewFinalVersion.getId());
                processCmd.setData(JSON.toJSONString(formViewEntity));
                processCmd.setAppId(baseUserInfo.getAppId());
                bpmProcessInstanceService.startProcessInstance(processCmd);
            }
        }
        return RestResponse.success();
    }

    /**
     * 历史备份
     *
    @RequestMapping(value = "/queryPageDataByViewId", method = RequestMethod.POST)
    @ApiOperation(value = "根据视图id查询数据", notes = "根据视图id查询数据")
    public PageBean<Map<String, Object>> queryDataByViewId(@RequestBody QueryListVo queryListVo) throws Exception {

        PageBean<Map<String, Object>> pageList = formServer.getPageList(queryListVo);

        if (pageList.getData() == null || pageList.getData().size() <= 0) {
            return pageList;
        }

        //查询视图的属性
        FormAttributePubEntity childAttribute = new FormAttributePubEntity();
        childAttribute.setStatus(SystemConst.NORMAL_STATUS);
        childAttribute.setViewId(queryListVo.getViewId());
        List<FormAttributePubEntity> attributeList = formAttributePubService.getList(childAttribute);
        //查找出系统人员字段
        List<String> sysUserFields = new ArrayList<>();


        //默认系统值处理字段归集
        for (FormAttributePubEntity attribute : attributeList) {
            if ("1".equals(attribute.getListView()) && "defaultSysValue".equals(attribute.getReferenceType()) && "sysUser".equals(attribute.getReferenceData())) {
                sysUserFields.add(attribute.getCode());
            }
        }


        for (FormAttributePubEntity attribute : attributeList) {
            if ("1".equals(attribute.getListView()) && "defaultSysValue".equals(attribute.getReferenceType()) && "sysUser".equals(attribute.getReferenceData())) {
                sysUserFields.add(attribute.getCode());
            }
            //处理视图数据映射
            if("1".equals(attribute.getListView()) && "view".equals(attribute.getReferenceType())){
                if(pageList.getData()!=null&&pageList.getData().size()>0){
                    //处理列表多条数据中的一个视图映射
                    for (int i = 0; i <pageList.getData().size() ; i++) {
                        Map<String, Object> item=pageList.getData().get(i);
                        if(BeanUtil.isNotEmpty(item.get(attribute.getCode().toUpperCase()))){
                            String viewDataName= queryDataShowNameByViewId(item.get(attribute.getCode().toUpperCase()).toString(),attribute.getReferenceData());
                            item.put((attribute.getCode()+"NAME").toUpperCase(),viewDataName);
                        }

                    }

                }

            }
        }
        if (sysUserFields.size() > 0) {
            List<Map<String, Object>> list = pageList.getData();
            for (String sysUserField : sysUserFields) {
                List<String> userIds = new ArrayList<>();

                for (int i = 0; i < list.size(); i++) {
                    if (BeanUtil.isNotEmpty(list.get(i).get(sysUserField.toUpperCase())) && StringUtil.isNotEmpty(list.get(i).get(sysUserField.toUpperCase()).toString())) {
                        userIds.add(list.get(i).get(sysUserField.toUpperCase()).toString());
                    }
                }
                if (userIds.size() > 0) {
                    List<UcUserEntity> users = ucUserService.queryByIds(userIds);
                    if (BeanUtil.isNotEmpty(users) && users.size() > 0) {
                        Map<String, UcUserEntity> userMap = users.stream().collect(Collectors.toMap(UcUserEntity::getId, item -> item));
                        for (int i = 0; i < list.size(); i++) {
                            if (BeanUtil.isNotEmpty(list.get(i).get(sysUserField.toUpperCase())) && StringUtil.isNotEmpty(list.get(i).get(sysUserField.toUpperCase()).toString())) {
                                UcUserEntity userBean = userMap.get(list.get(i).get(sysUserField.toUpperCase()).toString());
                                if (BeanUtil.isNotEmpty(userBean)) {
                                    list.get(i).put((sysUserField + "NAME").toUpperCase(), userBean.getUserName());
                                }

                            }
                        }
                    }

                }
            }
        }

        return pageList;
    }
    */

}